﻿///***************************************************************
/// 시  스  템 : Updms.Com.Dac
/// 단위시스템 : COM
/// 계      층 : Data Access Layer
/// 프로그램명 : Com_Dac_UPDMS_COM_PGM
/// 파  일  명 : Com_Dac_UPDMS_COM_PGM.cs
/// 설      명 : 프로그램
///***************************************************************
/// 수정ID 일자       이름     내용
///---------------------------------------------------------------
/// CH001  2008-08-06 송시명   최초 작성
///***************************************************************
using System.Data;
using System.Data.SqlClient;
using System.EnterpriseServices;
using System.Runtime.InteropServices;

using SMFramework.Data;

namespace Updms.Com.Dac
{
	[ComVisible(true)]
	[Transaction(TransactionOption.Supported)]
	[JustInTimeActivation(true)]
	public class Com_Dac_UPDMS_COM_PGM : Base.AppFramework.DacBase
	{
		public Com_Dac_UPDMS_COM_PGM()
		{
		}

		#region 메뉴 (GetMenuList)

		/// <summary>
		/// 메뉴정보 조회
		/// </summary>
		[AutoComplete]
		public DataSet GetMenuList(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_COM_PGM_Get_Menu_List";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_COM_PGM", ds, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region 시스템리스트 (GetSystemList)

		/// <summary>
		/// 등록된 시스템정보를 조회한다.
		/// </summary>
		[AutoComplete]
		public DataSet GetSystemList(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_COM_PGM_Get_System_List";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			
			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_COM_PGM", ds, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region 탭메뉴 (GetTabMenu)

		/// <summary>
		/// 메뉴정보 조회
		/// </summary>
		[AutoComplete]
		public DataSet GetTabMenu(DataPack lo_dp)
		{
			string strSql = "usp_UPDMS_COM_PGM_Get_Tab_Menu";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_COM_PGM", ds, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region NT [GetStartPage]
		/// <summary>
		/// Access_Level별 시작페이지 조회
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetStartPage(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_Get_Start_Page";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(ls_sql, "UPDMS_COM_PGM", ds, paramArray, CommandType.StoredProcedure);
		}
		
		#endregion

		#region NT [GetSearchCount]

		[AutoComplete]
		public int GetSearchCount(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_Get_Search_Count";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			return (int)_agent.ExecuteScalar(ls_sql, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [SelectProcess]

		[AutoComplete]
		public DataSet SelectProcess(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_Select_Paging";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(ls_sql, "UPDMS_COM_PGM", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [GetUpdmsStoredprocedureList]
		/// <summary>
		/// UPDMS에 등록된 스토어드프로시져 목록을 가져온다.
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetUpdmsStoredprocedureList(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_Get_Updms_Storedprocedure_List";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(ls_sql, "UPDMS_COM_PGM", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [GetAllDirDepth]
		/// <summary>
		/// 모든 디렉토리 정보를 가져온다.
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetAllDirDepth(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_Get_All_Dir_Depth";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(ls_sql, "UPDMS_COM_PGM", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [GetSystemNPgmList]
		/// <summary>
		/// 모든 시스템 및 프로그램 정보를 가져온다.
		/// </summary>
		/// <param name="ls_lang_set"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetSystemNPgmList(string ls_lang_set)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_Get_System_N_Pgm_List";

			SqlParameter[] paramArray =
			{
				new SqlParameter("ls_lang_set", ls_lang_set)
			};

			DataSet ds = new DataSet();
			return _agent.Fill(ls_sql, "UPDMS_COM_PGM", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [GetAllMenuList]
		/// <summary>
		/// 모든 메뉴정보를 가져온다.
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetAllMenuList(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_Get_All_Menu_List";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(ls_sql, "UPDMS_COM_PGM", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [GetAccessLog]
		/// <summary>
		/// 사용자별 접속로그 조회
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetAccessLog(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_ACCESS_LOG_Get_Access_Log";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(ls_sql, "UPDMS_COM_PGM_ACCESS_LOG", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region NT [GetPgmClassByAccessLevel]
		/// <summary>
		/// 접근권한별 프로그램분류명 조회
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public DataSet GetPgmClassByAccessLevel(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_Get_Pgm_Class_By_Access_Level";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();

			DataSet ds = new DataSet();
			return _agent.Fill(ls_sql, "UPDMS_COM_PGM", ds, paramArray, CommandType.StoredProcedure);
		}

		#endregion
		
		
		
		

		#region RT [Insert]

		[AutoComplete]
		public int Insert(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_Insert";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(ls_sql, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region RT [Update]

		[AutoComplete]
		public int Update(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_Update";			

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(ls_sql, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region RT [Delete]

		[AutoComplete]
		public int Delete(string ls_xml)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_Delete";

			SqlParameter[] paramArray =
			{
				new SqlParameter("ls_xml", ls_xml)
			};

			return _agent.ExecuteNonQuery(ls_sql, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region RT [SetMenuUseYn]
		/// <summary>
		/// 탭타이틀에서 메뉴의 사용여부를 수정한다 (리스트에서)
		/// </summary>
		/// <param name="lo_dp"></param>
		/// <returns></returns>
		[AutoComplete]
		public int SetMenuUseYn(DataPack lo_dp)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_Set_Menu_Use_Yn";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(ls_sql, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region RT [SetDirDepthBySeq] - 메뉴정렬관리(Com1020m)로 기능대체함. 2012-09-12
		///// <summary>
		///// Seq로 디렉토리 정보를 수정한다.
		///// </summary>
		///// <param name="lo_dp"></param>
		///// <returns></returns>
		//[AutoComplete]
		//public int SetDirDepthBySeq(DataPack lo_dp)
		//{
		//    string ls_sql = "usp_UPDMS_COM_PGM_Set_Dir_Depth_By_Seq";

		//    SqlParameter[] paramArray = lo_dp.ToSqlParameters();
		//    return _agent.ExecuteNonQuery(ls_sql, paramArray, CommandType.StoredProcedure);
		//}

		#endregion

		#region RT [SetHighMenuViewOrder]
		/// <summary>
		/// 메뉴정렬관리 - 정렬된 상위메뉴를 저장
		/// </summary>
		/// <param name="ls_xml"></param>
		/// <returns></returns>
		[AutoComplete]
		public int SetHighMenuViewOrder(string ls_xml, string ls_update_user)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_Set_High_Menu_View_Order";

			SqlParameter[] paramArray =
			{
				new SqlParameter("ls_xml", ls_xml),
				new SqlParameter("ls_update_user", ls_update_user)
			};

			return _agent.ExecuteNonQuery(ls_sql, paramArray, CommandType.StoredProcedure);
		}

		#endregion

		#region RT [SetMenuViewOrder]
		/// <summary>
		/// 메뉴정렬관리 - 정렬된 하위메뉴를 저장
		/// </summary>
		/// <param name="ls_xml"></param>
		/// <returns></returns>
		[AutoComplete]
		public int SetMenuViewOrder(string ls_xml, string ls_update_user)
		{
			string ls_sql = "usp_UPDMS_COM_PGM_Set_Menu_View_Order";

			SqlParameter[] paramArray =
			{
				new SqlParameter("ls_xml", ls_xml),
				new SqlParameter("ls_update_user", ls_update_user)
			};

			return _agent.ExecuteNonQuery(ls_sql, paramArray, CommandType.StoredProcedure);
		}

		#endregion
		
	}
}
